﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dictionary;

namespace Dictionary.BusLayer
{
    public class ModifyDictBus
    {
        //Ket qua tra ve true neu add thanh cong, false neu nhu da ton tai tu dien nay roi
        public static bool AddNewDict(string fn,string name)
        {
            DataLayer.FileDir.CreateFolder(DataLayer.FileDir.dirImage + "\\" + fn);
            return DataLayer.ModifyDict.AddNew(fn, name);
        }

        //Ham xoa bo tu dien
        public static bool DeleteDict(string fn)
        {
            return DataLayer.ModifyDict.Delete(fn);
        }

        //Ham kiem tra xem bo tu dien can chep co hay chua
        public static bool AddExistCheckFile(string fn)
        {
            return DataLayer.FileDir.CheckFile(DataLayer.FileDir.dirPath + "\\" + System.IO.Path.GetFileName(fn));
        }

        //Ham kiem tra noi dung bo tu dien
        public static bool CheckContentDict(string fn)
        {
            return DataLayer.LoadData.CheckDicContent(fn);
        }

        //Ham them bo tu dien moi
        public static bool AddExistDict(string fn)
        {
            DataLayer.FileDir.CreateFolder(DataLayer.FileDir.dirImage + "\\" + System.IO.Path.GetFileNameWithoutExtension(fn));
            return DataLayer.FileDir.CopyToLib(fn);
        }
    }
}
